Skip to content

add failing test for ItemSeparatorComponent state bug#55707

Open
wolf-at-mystro wants to merge 2 commits into
react:mainfrom
wolf-at-mystro:wolf/ItemSeparatorComponent-state-test
Open

add failing test for ItemSeparatorComponent state bug#55707
wolf-at-mystro wants to merge 2 commits into
react:mainfrom
wolf-at-mystro:wolf/ItemSeparatorComponent-state-test

Conversation

@wolf-at-mystro

@wolf-at-mystro wolf-at-mystro commented Feb 23, 2026

Copy link
Copy Markdown

Summary:

Bug: VirtualizedSectionList passes incorrect leading/trailingItem to ItemSeparatorComponent

Our app has a <SectionList> which was intermittently rendering ItemSeparatorComponents with wildly incorrect leadingItem/trailingItem props, including undefined, which as far as I can tell should never happen.

(While I’m here, I would also like to complain that the type definition for this prop is React.ComponentType<any> so I also spent a bit of time trying to work out if undefined was even an expected value.)

After investigation, it turns out that ItemWithSeparator keeps these values in state, so when the same cell happens to re-render with new props (for example when the virtualized list renders a different region), the separator keeps the previous leadingItem/trailingItem, which can be undefined if that previous row was at a section boundary.

I attach here a failing unit test which reproduces this behavior.

Changelog:

[General] [Fixed] - VirtualizedSectionList passes correct leading/trailingItem to ItemSeparatorComponent

Test Plan:

Run the test and observe it failing. I looked into fixing it, but was stymied by the highlighting and updateProps features: they also store state on ItemWithSeparator, which presumably is equally incorrect when it moves, but I don’t understand what the intended behavior is here or where that state ought to live instead. (For example, if you highlight the separator between items B and C, and item B is removed, should the highlight be transferred to the now A-C separator?)

@meta-cla

meta-cla Bot commented Feb 23, 2026

Copy link
Copy Markdown

Hi @wolf-at-mystro!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 23, 2026
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants